package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionSingeltonDAO {

	private static Connection ConnectionSingelton;
	
	private ConnectionSingeltonDAO(){
		
	}
	
	public static Connection getConnectionInstance() throws SQLException{
		
		if (null == ConnectionSingelton){
			try {
				Class.forName("com.mysql.jdbc.Driver").newInstance();
			} catch (InstantiationException | IllegalAccessException
					| ClassNotFoundException e) {
				e.printStackTrace();
				System.out.println("JDBC Driver nicht gefunden!");
			}
			String conURL = "jdbc:mysql://192.168.1.213/mytradedb";
			ConnectionSingelton = DriverManager.getConnection(conURL, "dbuser", "123456");
			//ConnectionSingelton.createStatement().execute("SET NAMES 'utf8'");
		}
	
		return ConnectionSingelton;
	}
	
}